package com.yanggu.bigdata.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class LoggerController {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @GetMapping("test")
    public String test(@RequestParam String test) {
        return test;
    }

    @GetMapping("applog")
    public String getLogger(@RequestParam String param) {

        //落盘
        log.info(param);

        //写入kafka
        kafkaTemplate.send("ods_base_log", param);

        return "success";
    }

}
